package com.yhp.bean;

import java.util.Objects;

public class Message {

    //0表示成功   -1表示失败

    //状态码
    private int status;

    //消息内容
    private String result;

    //消息携带的一组数据
    private Object data;


    public Message(int status, String result, Object data) {
        this.status = status;
        this.result = result;
        this.data = data;
    }

    public Message() {
    }

    public Message(int status) {
        this.status = status;
    }

    public Message(int status, String result) {
        this.status = status;
        this.result = result;
    }

    public Message(String result) {
        this.result = result;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Message message = (Message) o;
        return status == message.status && Objects.equals(result, message.result) && Objects.equals(data, message.data);
    }

    @Override
    public int hashCode() {
        return Objects.hash(status, result, data);
    }

    @Override
    public String toString() {
        return "Message{" +
                "status=" + status +
                ", result='" + result + '\'' +
                ", data=" + data +
                '}';
    }
}
